#ifndef __BSP_MISC_H
#define __BSP_MISC_H

#include "gd32f4xx.h"
#include "systick.h"
#define SYSTEM_CLOCK_FREQ	240

#define DWT_CR				*(__IO uint32_t *)0xE0001000
#define DWT_CYCCNT			*(__IO uint32_t *)0xE0001004
#define DEM_CR				*(__IO uint32_t *)0xE000EDFC

#define DEM_CR_TRCENA		(1 << 24)
#define DWT_CR_CYCCNTENA	(1 << 0)

#ifndef BOOL
#define BOOL uint8_t
#endif


#ifndef FALSE
#define FALSE	0
#endif

#ifndef TRUE
#define TRUE	!FALSE
#endif

void Delay_Soft(__IO uint32_t nCount);
void CoreDelay_Init(void);
void Delay_us(uint32_t us);
void Delay_ms(uint32_t mseconds);
#endif	/* __BSP_MISC_H */
